package com.come4loves.game.dbproxy.entity;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import com.come4loves.core.dbcenter.Entity;
import com.come4loves.core.dbcenter.annotation.Column;

/**
 * 竞技场
 * @author 8wy00
 *
 */
public class Arena extends Entity<Long> {

	private static final long serialVersionUID = 2998950420307822511L;

	@Column(pk = true)
	public long actorId;

	/**
	 * 竞技场积分
	 */
	@Column
	public int score;

	/**
	 * 竞技场等级
	 */
	@Column
	public int level;

	@Override
	public Long getPkId() {
		return actorId;
	}

	@Override
	public void setPkId(Long pk) {
		actorId = pk;
	}

	@Override
	protected Entity<Long> readData(ResultSet rs, int rowNum) throws SQLException {
		Arena arena = new Arena();
		arena.actorId = rs.getLong("actorId");
		arena.score = rs.getInt("score");
		arena.level = rs.getInt("level");
		return arena;
	}

	@Override
	protected void hasReadEvent() {

	}

	@Override
	protected ArrayList<Object> writeData(Boolean containsPK) {
		ArrayList<Object> values = new ArrayList<Object>();
		if (containsPK) {
			values.add(this.actorId);
		}
		values.add(this.score);
		values.add(this.level);
		return values;
	}

	@Override
	protected void beforeWritingEvent() {
		
	}

	@Override
	protected void disposeBlob() {

	}

}
